import {
  ref,
  getCurrentInstance,
  ComponentInternalInstance
} from 'vue';

export default function() {
  const { proxy } = getCurrentInstance() as ComponentInternalInstance
  const msg = ref<string>('')
  const count = ref<number>(0)
  const dialogVisible = ref<boolean>(false)
  const methods = {
    addCount() {
      count.value += 1
      dialogVisible.value = !dialogVisible.value
      proxy.$message.success('get')
    },
    handleClose() {
      dialogVisible.value = false
    }
  }
  return {
    msg,
    count,
    dialogVisible,
    methods
  }
}